<div style="padding: 15px" xmlns:th="http://www.thymeleaf.org">
    <form id="form">
        <input type="hidden" name="pwdOld" id="pwdOld">
        <input type="hidden" name="pwdNew" id="pwdNew">
        <div class="form-group">
            <label>原密码</label>
            <input type="password" class="form-control" placeholder="请输入" id="password1">
        </div>
        <div class="form-group">
            <label>新密码</label>
            <input type="password" class="form-control" placeholder="请输入" id="password2">
        </div>
        <div class="form-group">
            <label>再次输入</label>
            <input type="password" class="form-control" placeholder="请输入" id="password3">
        </div>
        <button type="button" class="btn btn-primary" id="submitBtn">提交</button>
    </form>
</div>
<script>
    $("#submitBtn").click(function () {
        var password1 = $("#password1").val();
        if (password1 === '') {
            msgAlert("请输入原密码");
            return;
        }
        var password2 = $("#password2").val();
        if (password2 === '') {
            msgAlert("请输入新密码");
            return;
        }
        var password3 = $("#password3").val();
        if (password3 === '') {
            msgAlert("请再次输入新密码");
            return;
        }
        if (password2 != password3) {
            msgAlert("两次新密码输入不一致");
            return;
        }
        $("#pwdOld").val(hex_md5(password1 + KEY));
        $("#pwdNew").val(hex_md5(password2 + KEY));
        ajaxJson("/user/ajax/update/password", $("#form").serialize(), function (res) {
            msgAlert(res.message);
            if (res.status) {
                $("#password1,#password2,#password3,#pwdOld,#pwdNew").val("");
            }
        })
    })
</script>